import {request} from "../request";
import {utils} from "../../common/utils";

// 新增
export function addEmpt(empt){
    console.log(empt + " <-- ")
    return request({
        url: '/jobDemand/sav',
        method: 'post',
        data:empt
    })
}

/**
 *
 * @param columnMap  分类查询
 * 0 全部 1、未处理 2、正在招聘 3、已满足 4、无用
 */
export function getDemand(columnMap){
    return request({
        url:'/jobDemand/selDemandSort',
        method:'post',
        data: columnMap
    })
}

// 根据id删除
export function delJobById(ros){
    console.log('ros',ros)
    let strUrl = utils.joinArrayReqParam(ros,'ids');
    console.log(ros + '请求')
    return request({
        url:'/jobDemand/deljob/' + strUrl,
        method:'delete'
    })
}

// 根据id发布
export function selUptJob(par,name){
    if (name === "查询"){
        console.log("ins",par)
        return request({
            url:'/jobDemand/sela/' + par,
            method:'get',
        })
    }
    if (name === "发布"){
        console.log("upt",par)
        return request({
            url:'/jobDemand/rel/' + par,
            method:'put'
        })
    }
    if (name === "取消"){
        console.log("by0 " , par)
        return request({
            url:'/jobDemand/uzero/' + par,
            method:'get'
        })
    }
}

export function selChannel(){
    return request({
        url:"/pubChannel",
        method:'get'
    })
}

// 新增岗位发布记录
export function insjpr(jobpubids,jobid){
    console.log("集合",jobpubids)
    console.log(jobid+"----")
    return request({
        url:"/jobPubRecord/ins",
        method:'post',
        data:{
            jobpubids,
            jobid
        }
    })
}

// 新增岗位渠道
export function inspbc(pub){
    console.log("新增渠道 -> ",pub)
    return request({
        url:'/pubChannel/inspc',
        method:'post',
        data:pub
    })
}

// 查询发布需求申请的员工
export function selEmpByJob(){
    return request({
        url:'/jobDemand/empbyjob',
        method:'get'
    })
}
//put 修改
//post 新增
//delete 删除
//get 查询